package com.mx.adapt.picker

import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.TextView
import androidx.viewbinding.ViewBinding
import com.mx.adapt.MXBaseSimpleAdapt
import com.mx.adapt.databinding.LayoutMxPickerStringItemBinding

class MXStringPickerAdapt : MXBaseSimpleAdapt<String>() {
    var itemProcess: ((position: Int, container: FrameLayout, textView: TextView) -> Unit)? = null
    override fun createItem(
        inflater: LayoutInflater,
        parent: ViewGroup,
        viewType: Int
    ): ViewBinding {
        return LayoutMxPickerStringItemBinding.inflate(inflater, parent, false)
    }

    override fun bindView(position: Int, binding: ViewBinding, record: String) {
        binding as LayoutMxPickerStringItemBinding
        itemProcess?.invoke(position, binding.root, binding.infoTxv)
        binding.infoTxv.text = record
    }
}